import { EzFormControlConfiguration } from '../ez-form-control';
import { EzCascader } from './ez-cascader';
import { EzFormGroup } from '../ez-form-group';
import { EzForm } from '../ez-form';

/**
 * 级联选择器可选项
 */
export interface EzCascaderOption {
  value?: any;
  label?: string;
  disabled?: boolean;
  isLeaf?: boolean;
  children?: EzCascaderOption[];
}

/**
 * 级联选择器配置项
 */
export interface EzCascaderConfiguration extends EzFormControlConfiguration<(number | string)[], EzCascader> {
  type: 'cascader';
  /**
   * 可选项
   */
  options:
    | EzCascaderOption[]
    | ((
        option: EzCascaderOption,
        index: number,
        control: EzCascader,
        group: EzFormGroup,
        form: EzForm
      ) => Promise<EzCascaderOption[]>);
}
